package com.vim.modules.mall.service.remote;

import com.vim.modules.mall.model.base.CommonPage;
import com.vim.modules.mall.model.base.MallResponseEntity;
import com.vim.modules.mall.model.mallOrder.MallOrder;
import com.vim.modules.mall.model.mallOrder.MallOrderUnion;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @作者 Administrator
 * @时间 2020-10-04 19:06
 * @版本 1.0
 */
@Service
@FeignClient(name = "web-gateway", contextId = "remoteMallOrderService", fallback = RemoteMallOrderServiceFallBack.class)
public interface RemoteMallOrderService {

    /**
     * 获取订单列表
     * @param pageNo 当前页码
     * @param pageSize 每页数量
     */
    @GetMapping("/adminApi/order/orderList")
    MallResponseEntity<CommonPage<MallOrder>> orderList(
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
    );

    /**
     * 获取订单详情
     * @param orderId 订单id
     */
    @GetMapping("/adminApi/order/orderDetail/{orderId}")
    MallResponseEntity<MallOrderUnion> orderDetail(@PathVariable(value = "orderId") Long orderId);

    /**
     * 订单发货
     * @param orderId 订单id
     */
    @PostMapping("/adminApi/order/orderDelivery")
    MallResponseEntity orderDelivery(@RequestParam(value = "orderId") Long orderId);

}
